package com.scf.loanmanage.controller;

import com.scf.loanmanage.entity.LoanLevelFive;
import com.scf.loanmanage.entity.PageBean;
import com.scf.loanmanage.service.ServiceImp.LoanLevelFiveImpl;
import com.scf.uitl.ResponseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController

@RequestMapping("/LoanLevelFive")
public class LoanLevelFiveController {



    @Resource
    LoanLevelFiveImpl repaymentService;


    @GetMapping("/LoanLevelFiveAll")
    public ResponseResult selectAll(Integer pageIndex, Integer pageSize) {
        List<LoanLevelFive> repayments = repaymentService.selectAll(pageIndex,pageSize);
        Integer selectcount = repaymentService.selectcount();
        System.out.println("一共："+selectcount);
        ResponseResult resposeResult=new ResponseResult();
        resposeResult.setCode(200);
        PageBean<LoanLevelFive> pageBean=new PageBean<>();
        pageBean.setBeanList(repayments);
        pageBean.setPageBegin(pageIndex);
        pageBean.setPageEnd(pageSize);
        pageBean.setTotalRecord(selectcount);
        resposeResult.setData(pageBean);
        return resposeResult;
    }

    @GetMapping("/selcetByname")
    public ResponseResult selectByname(String enterprisename,String code) {
        List<LoanLevelFive> repayments = repaymentService.selectByname(enterprisename, code);
        ResponseResult resposeResult=new ResponseResult();
        resposeResult.setCode(200);
        resposeResult.setData(repayments);
        return resposeResult;
    }

}
